In [6]:
import pandas as pd
import numpy as np
import plotly.express as px

Data¶

In [7]:
df = pd.read_csv('Salon_Data.csv')
df.head(10)
Out[7]:
date time haircut price hair_stylist gender type rating
0 01-07-2021 morning hair 150 Asim Male regular 4.0
1 01-07-2021 morning hair 250 Viraj Female new 4.7
2 01-07-2021 noon beard 100 Atif Male regular 4.2
3 01-07-2021 noon hair 150 Asim Male new 3.7
4 01-07-2021 noon all 350 Viraj Male regular 4.8
5 01-07-2021 mid noon beard 100 Atif Male regular 4.1
6 01-07-2021 mid noon all 300 Asim Male regular 4.3
7 01-07-2021 noon all 300 Asim Male regular 4.3
8 01-07-2021 morning hair 150 Asim Male regular 4.0
9 01-07-2021 noon hair 250 Viraj Female new 4.7
In [23]:
from plotly.offline import init_notebook_mode
init_notebook_mode()

Analysis with Scatter plot.¶

In [8]:
fig = px.scatter(df, x="rating", color='hair_stylist', y="date", range_x=[3.5,5], range_y=[0,13],template='plotly_dark', animation_frame = 'gender', size_max=20)
fig.show()
In [9]:
fig = px.scatter_3d(df, x='rating', y='date', z=df['haircut'].replace({'all':1,'beard':2, 'hair':3}),
                     symbol='hair_stylist')
fig.show()
In [10]:
fig = px.box(df, y="price",points='all')
fig.show()
In [11]:
date_count = df.date.value_counts().sort_index()
date_count
Out[11]:
01-07-2021    30
02-07-2021    21
03-07-2021    21
04-07-2021    30
05-07-2021    35
06-07-2021    29
07-07-2021    30
08-07-2021    25
09-07-2021    17
10-07-2021    27
11-07-2021    33
12-07-2021    47
Name: date, dtype: int64

Understanding Sales of haircut.¶

In [12]:
fig = px.line(df, x=date_count.keys(), y=date_count, title='Sales of haircut')
fig.show()

Analysis of Sales with respect to price.¶

In [13]:
fig = px.violin(df, y=df.price, title= 'Sales with respect to price')
fig.show()

Price Vs Rating

In [14]:
fig = px.scatter(df, x="rating", y="price", color="rating", marginal_y="violin",
           marginal_x="box", trendline="ols", template="simple_white",
           title='Price vs Rating')
fig.show()

Analysis of haircut using pie chart.¶

The amount earned is approximatley same of all hairstylist.

In [15]:
fig = px.pie(df, values='price', names='hair_stylist', color='hair_stylist', hole=.3, color_discrete_map={'Atif':'#1261A0','Asim':'#072F5F','Viraj':'#3895D3'})
fig.show()

Using rating on all hairstylist we know that Viraj is best and Atif, Asim are equaly competing each other

In [16]:
fig = px.pie(df, values='rating', names='hair_stylist', color='hair_stylist', hole=0.3, color_discrete_map={'Atif':'#1261A0','Asim':'#072F5F','Viraj':'#3895D3'})
fig.show()

The below graph shows that, There are more men haircuts than women, which also states that men vist frequently than women.

In [17]:
fig = px.pie(df, values='price', names='gender', color='gender', color_discrete_map={'Male':'#006279', 'Female':'#abc0bb'})
fig.show()

The below graph states that.

  1. Maximum haircut are of 'All' and 'hair' type
  2. Less men prefer to trim 'beard' only at salon
  3. Since men are frequent the number of haircuts are most
In [18]:
fig = px.pie(df, values='price', names='haircut', color='haircut', hole=0.3, color_discrete_map={'all':'#1261A0','hair':'#072F5F','beard':'#3895D3'})
fig.show()

73.4% customer prefer their regular hairstyle and 26.6% prefer something new.

In [19]:
fig = px.pie(df, values='price', names='type', color='type', color_discrete_map={'new':'#006279', 'regular':'#abc0bb'})
fig.show()

Co-relation of price and rating.¶

The below graph is intereactive visual representation of density heatmap between price and rating.

we can see that, 41 ratings with value '4.1' are given to price ranging between 150-190.

In [20]:
fig = px.density_heatmap(df, x="rating", y="price", marginal_x="histogram", marginal_y="histogram", color_continuous_scale=px.colors.sequential.Greys)
fig.show()